package com.example.demo01.service.Impl;

import com.example.demo01.eneity.YzfUser;
import com.example.demo01.mapper.YzfUserMapper;
import com.example.demo01.service.YzfUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YzfUserServiceImpl implements YzfUserService {

    @Autowired
    private YzfUserMapper yzfUserMapper;


    @Override
    public void insertUser(YzfUser user) {
        // 调用YzfUserMapper中的方法来插入用户信息
        yzfUserMapper.insertUser(user);
        System.out.println("User added: " + user);
    }

    @Override
    public YzfUser getID(Integer id) {
        // 根据id获取用户信息
        return null;
    }

    @Override
    public void deleteUserById(int userId) {
        // 根据id删除用户信息
        yzfUserMapper.deleteUserById(userId);
    }

    @Override
    public void updateUser(YzfUser user) {
        // 根据id更新用户信息
        yzfUserMapper.updateUser(user);
    }

    @Override
    public List<YzfUser> findUsersByUsername(String username) {
        // 根据用户名查找用户信息
        return yzfUserMapper.findUsersByUsername(username);
    }




}

